<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

    String type = request.getParameter("type");
    String budgetId = request.getParameter("budgetId");
%>
<html>
<head>
    <title>项目详情</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <link type="text/css" rel="stylesheet" href="/lib/budget/styles.css"/>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>

    <script type="text/javascript" charset="utf-8" src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/layer/layer.js?20201106"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" ></script>
    <script type="text/javascript" charset="utf-8" src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" ></script>
    <script type="text/javascript" charset="utf-8" src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" ></script>
    <script type="text/javascript" charset="utf-8" src="/js/base/base.js"></script>
    <style>
        a{
            text-decoration: none;
        }
        .main{
            width: 788px;
            margin: 0 auto;
            box-sizing: border-box;
            /*box-shadow: 0px 0px 16px 5px #b8b3b3;*/
            padding: 14px;
        }
        .nav{
            height: 40px;
            border-bottom: 1px solid #000;
            font-size: 22px;
            padding-top: 10px;
            font-weight: 400;
        }
        .leftspan{
            display: inline-block;
            width: 156px;
            text-align: right;
            margin-right: 52px;
        }
        ul,li{
            list-style: none;
            margin:12px 0;
            padding: 0;
        }
        input{
            width: 376px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 2px;
            padding-left: 6px;
        }
        .inputsmall{
            width: 154px;
            height: 30px;
            text-align: center;
            padding-left: 0px;
        }
        .line{
            height: 2px;
            width: 59px;
            background: #8a8686;
            display: inline-block;
            line-height: 30px;
            position: relative;
            bottom: 4px;
        }
        .btn{
            font-size: 14px;
            background-color: #008cff;
            padding: 4px 18px;
            border-radius: 3px;
            color: #fff;
            cursor:pointer;
        }
        textarea{
            width: 376px;
            height: 76px;
            padding-left: 6px;
        }
        .spspan{
            position: relative;
            bottom: 60px;
        }
        .list{
            text-align: center;
            margin: 60px 0;
        }
        .list span{
            font-size: 18px;
            background-color: #008cff;
            padding: 6px 48px;
            border-radius: 3px;
            color: #fff;
            cursor: pointer;
            margin: 0 3px;
        }
        .uploadbox{
            margin-left: 0px;
            padding-top: 6px;
        }
        select {
            width: 376px;
            height: 30px;
            border: 1px solid #ccc;
            border-radius: 2px;
            padding-left: 6px;
        }
        .mustinput{
            color: red;
            height: 26px;
            line-height: 32px;
            margin-left: 5px;
        }
    </style>
</head>
<body>
<div class="main">
    <p class="nav">项目详情</p>
    <ul>
        <li>
            <span class="leftspan">项目排序号：<font class="mustinput">*</font></span>

            <span><input type="text" id="budgetItemNo" disabled></span>
        </li>
        <li>
            <span class="leftspan">指标分类：<font class="mustinput">&nbsp;</font></span>
            <span><input type="text" id="quotaClassify" disabled></span>
        </li>
        <li>
            <span class="leftspan">项目名称：<font class="mustinput">*</font></span>
            <span><input type="text" id="budgetItemName" disabled></span>
        </li>
        <li>
            <span class="leftspan">项目周期：<font class="mustinput">*</font></span>

            <span><input type="text" disabled placeholder="请选择日期" id="budgetItemBegintime" class="inputsmall" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  ></span>
            <span class="line"></span>
            <span><input type="text" disabled placeholder="请选择日期" id="budgetItemEndtime" class="inputsmall" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  ></span>
        </li>
        <li>
            <span class="leftspan">录入时间：<font class="mustinput">&nbsp;</font></span>
            <%--<span><input type="text" id="inputTime"></span>--%>
            <span><input type="text"  disabled placeholder="请选择日期" id="inputTime" style="padding-left: 10px" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  ></span>
        </li>

        <li>
            <span class="leftspan">额度号：<font class="mustinput">*</font></span>
            <span><input type="text" id="lineNo1" disabled ></span>
        </li>
        <li>
            <span class="leftspan">上级项目：<font class="mustinput">&nbsp;</font></span>
            <select name="postPriv" class="BigSelect" id="priveItem" disabled>
                <option value="0">请选择上级项目</option>
            </select>
        </li>
        <li>
            <span class="leftspan">项目金额：<font class="mustinput">*</font></span>

            <span><input type="text"  id="itemMoney" disabled></span>
        </li>

        <li>
            <span class="leftspan">可用金额：<font class="mustinput">*</font></span>

            <span><input type="text"  id="syje" disabled></span>
        </li>
        <li>
            <span class="leftspan">预支出金额：<font class="mustinput">*</font></span>

            <span><input type="text"  id="allAdvance" disabled></span>
        </li>

        <li>
            <span class="leftspan">项目负责人：<font class="mustinput">*</font></span>


            <input disabled class="td_title1 release1" id="itemManager" disabled type="text" username="">
           <%-- <a href="javascript:;" class=" ml8 userPrivAdd btn add3" name="orgAdd">添加</a>
            <a href="javascript:;" class=" ml8 userPrivClear btn clear3" name="orgClear">清除</a>--%>
        </li>
        <li>
            <span class="leftspan">所属部门：<font class="mustinput">*</font></span>

            <span><input disabled type="text" id="department"></span>
            <%--<span class="btn adddept">添加</span>
            <span class="btn clear">清除</span>--%>
        </li>
        <li>
            <span class="leftspan">项目执行人：<font class="mustinput">*</font></span>

            <input disabled class="td_title1 release1" id="itemExecuter" disabled type="text" username="">
            <%--<a href="javascript:;" class=" ml8 userPrivAdd btn add4" name="orgAdd">添加</a>
            <a href="javascript:;" class=" ml8 userPrivClear btn clear4" name="orgClear">清除</a>--%>
        </li>
        <li>
            <span class="leftspan">项目描述：</span>
            <span class="leftspan"><textarea name=""  id="itemDesc" style="font-family: '微软雅黑'" disabled></textarea></span>
        </li>
        <li>
            <span class="leftspan">附件：</span>
            <div class="uploadbox" style="display: inline-block;"></div>
        </li>
    </ul>
</div>
</body>
<script>
    function inputcheck(name,value) {
        $('#'+name+'').val(value)
    }
    function preveCheck(name,value) {
        $('#'+name+'').html(value)
    }
    function getRequest() {
        var url = window.location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for(var i = 0; i < strs.length; i ++) {

                theRequest[strs[i].split("=")[0]]=decodeURI(strs[i].split("=")[1]);

            }
        }
        return theRequest;
    }
    var budgetId= getRequest().budgetId;
    $.ajax({
        url:'/budget/selBudgetItemById',
        type:'get',
        data:{
            'budgetId':budgetId
        },
        dataType:'json',
        success:function(res){
            var obj=res.object;
            if(res){
                inputcheck('budgetItemNo',obj.budgetItemNo);
                inputcheck('quotaClassify',obj.quotaClassify);
                inputcheck('budgetItemName',obj.budgetItemName);
                inputcheck('budgetItemBegintime',obj.budgetItemBegindate);
                inputcheck('budgetItemEndtime',obj.budgetItemEnddate);
                inputcheck('inputTime',obj.inputTime);
                inputcheck('department',obj.deptName);
                inputcheck('lineNo1',obj.lineNo);
                inputcheck('syje',obj.remainingAmount);
                preveCheck('priveItem>option:selected',obj.priveItem);
                inputcheck('itemMoney',obj.itemMoney);
                inputcheck('itemitemRate',obj.itemRate);
                inputcheck('itemManager',obj.itemManagerName);
                inputcheck('itemExecuter',obj.itemExecuterName);
                inputcheck('itemDesc',obj.itemDesc);
                inputcheck('allAdvance',obj.allAdvance)
                $('#itemDesc').val(obj.itemDesc)


                var str = '';
                var urlObj = obj.attachmentUrl;
                var nameObj = obj.attachmentName;
                var arrList = obj.attachments;
                if(arrList !="" && arrList != undefined){
                    if(arrList.length>0){
                        for(var i=0;i<arrList.length;i++){
                            str+='<div class="dech" attachmentUrl="'+arrList[i].attUrl+'" style="display:block;margin:6px 0;"><a class="ATTACH_a" NAME="'+arrList[i].attachName+'" href="<%=basePath %>download?'+encodeURI(arrList[i].attUrl)+'"><img src="/img/attachment_icon.png" style="margin-right:5px" alt="">'+arrList[i].attachName+'</a><img class="deImgs2" style="margin-left:5px;cursor: pointer;" src="../img/file/icon_deletecha_03.png"/><input type="hidden" attachmentName="'+arrList[i].attUrl+'"  class="inHidden" value="'+arrList[i].aid+'@'+arrList[i].ym+'_'+arrList[i].attachId+',"></div>';

                        }
                        $('.uploadbox').html(str);
                    }
                }

                if(!(urlObj == undefined || nameObj == undefined)){ // || obj.attachmentName == 'undefined'
                    str+='<div class="dech" attachmentUrl="'+urlObj+'" style="display:block;margin:6px 0;"><a class="ATTACH_a" NAME="'+obj.attachmentName+'" href="<%=basePath %>download?'+encodeURI(urlObj)+'"><img src="/img/attachment_icon.png" style="margin-right:5px" alt="">'+nameObj+'</a><img class="deImgs2" style="margin-left:5px;cursor: pointer;" src="../img/file/icon_deletecha_03.png"/><input type="hidden" attachmentName="'+nameObj+'*"  class="inHidden" value=""></div>';

                }
                $('.uploadbox').html(str);
            }
        }
    })
</script>
</html>
